$ini = 50;
					    					//////////////////////////
						
						//pregunta por el personal
$sqlper1="select a.ug_id as cod, b.ut_codprog as codigo, CONCAT(a.ua_apepat,' ',a.ua_apemat,' ',a.ua_nom) as nombre, ";
$sqlper1= $sqlper1." b.ut_idserva as idsa, b.ut_obs as obs1 from tb_usutrab b  inner join tb_usuasist a on a.ug_id= b.ug_id where b.j_id='$idj'";
$sqlper1= $sqlper1." and b.tp_id='$idtp' and b.ut_idserva='$ids' and b.uap_anno='$anno' and b.uap_mes ='$mm' order by nombre";
//Echo $sqlper1."<br>";
//horas por los servicios
$a=1;
$sumaho=0;
$sumahe=0;
$resultper = mysql_query($sqlper1);
while ($rowp= mysql_fetch_array($resultper)){
$ugid = $rowp['cod'];
$codprog = $rowp['codigo'];
$nombre = $rowp['nombre'];
$obsp = $rowp['obs1'];

//suma de horas del personal por el servicio
$sqlhoras="select chp_numgd as gd, chp_numgn as gn, chp_numho as ho, chp_numhe as he from tb_consolhprog where ug_id='$ugid' and uap_anno='$anno' and uap_mes='$mm' and ut_idserva='$ids' and s_id='$ids' and tp_id='$idtp' and j_id='$idj'";
//echo $sqlhoras."<br>";
$resulthoras = mysql_query($sqlhoras);
	if(mysql_num_rows($resulthoras)==0){
			$personallista = array($a,$codprog,$nombre,0,0,0,);
	}else{
	while ($rowhs= mysql_fetch_array($resulthoras)){
		$ho = $rowhs['ho'];
		$he = $rowhs['he'];
		$sumaho = $sumaho + $ho;
		$sumahe = $sumahe + $he;
			$personallista = array($a,$codprog,$nombre,$ho,$he,$ho+$he,$obsp);
		
	}
	}
	$alin = array('C','C','L','C','C','C','C');
	$pdf->ImprimirTablaPersonal($personallista,15,$ini,$ha,$wh,$alin);	
	$ini = $ini + $ha;
	$a = $a+1;
}
						
						
						////////////////////////
						
						$subtitulo = array('TOTAL',$sumaho,$sumahe,$sumaho+$sumahe,);
						$wh= array($sumat*0.35,$sumat*0.06,$sumat*0.06,$sumat*0.06,$sumat*0.20);
						$pdf->ImprimirTablaHorario($subtitulo,15,$ini,$ha,$wh,'C');	
						$ini = $ini + $ha;